﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://www.codeplex.com/EmlenMud
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrainTechLLC.ThreadSafeObjects;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace BrainTechLLC
{
    [Flags]
    [DataContract]
    public enum Symmetry { [EnumMember]None = 0, [EnumMember] XAxis = 1, [EnumMember] YAxis = 2, [EnumMember] ZAxis = 4 }

    [DataContract]
    public enum GeneralDirection { [EnumMember]None = 0, [EnumMember] N, [EnumMember] E, [EnumMember] W, [EnumMember] S, [EnumMember] NW, [EnumMember] NE, [EnumMember] SE, [EnumMember] SW, [EnumMember] Max };

    [DataContract]
    public enum ReverseDirections { [EnumMember]None = 0, [EnumMember] S, [EnumMember] W, [EnumMember] E, [EnumMember] N, [EnumMember] SE, [EnumMember] SW, [EnumMember] NW, [EnumMember] NE, [EnumMember] Max };

    public static class DirExt1
    {
        public static Random _rand = new Random();

        public static GeneralDirection ToGeneralDirection(this int n)
        {
            return (GeneralDirection)n;
        }

        public static GeneralDirection GetRandom(this GeneralDirection dir)
        {
            return dir.GetRandom(GeneralDirection.Max);
        }

        public static GeneralDirection GetRandom(this GeneralDirection dir, GeneralDirection maxDirection)
        {
            GeneralDirection dirRandom = (GeneralDirection)_rand.Next(1, (int)maxDirection);
            return dirRandom;
        }
    }
}